import VueRouter from "vue-router";
import LoginVue from "@/views/LoginVue.vue";
import LayoutVue from "@/views/LayoutVue.vue";
import IndexVue from "@/views/IndexVue.vue";
import PersonVue from "@/views/PersonVue.vue";
import GoodsVue from "@/views/GoodsVue.vue";
import StorehouseVue from "@/views/StorehouseVue.vue";
import InventoryVue from "@/views/InventoryVue.vue"
import OutgoodsVue from "@/views/OutgoodsVue.vue"

import YuceVue from "@/views/YuceVue.vue"

import Vue from "vue";

Vue.use(VueRouter)

const routes =[
   {
    path: '/',
    name: 'LoginVue',
    meta: { title: '登录' },
    component: LoginVue
    },
    {
    path:'/layout',
    name: 'LayoutVue',
    meta:{
        title: '父'
    },
    redirect:'/index',
    component: LayoutVue,
    children: [
        { path: '/index', name: 'IndexVue', meta: { title: '首页' }, component: IndexVue },
        { path: '/person', name: 'PersonVue', meta: { title: '人员' }, component: PersonVue },
        { path: '/goods', name: 'GoodsVue', meta: { title: '商品信息' }, component: GoodsVue },
        { path: '/storehouse', name: 'StorehouseVue', meta: { title: '仓库信息' }, component: StorehouseVue },
        { path: '/inventory', name: 'InventoryVue', meta: { title: '库存信息' }, component: InventoryVue },
        { path: '/outgoods', name: 'OutgoodsVue', meta: { title: '出库记录' }, component: OutgoodsVue },
        { path: '/yuce', name: 'YuceVue', meta: { title: '商品预测' }, component: YuceVue },
        // { path: '/TpersonMsg', name: 'TpersonMsg', meta: { title: '教师个人信息' }, component: TpersonMsg },
        // { path: '/EditPwd', name: 'EditPwd ', meta: { title: '修改密码' }, component: EditPwd },
        // { path: '/StuCourse:courseName:courseId:teaName:classId', name: 'StuCourse ', meta: { title: '学生具体课程信息' }, component: StuCourse },
        // { path: '/TeaCourse:courseName:courseId:classId', name: 'TeaCourse ', meta: { title: '教师具体课程信息' }, component: TeaCourse },
        // { path: '/WorkSubmit:homeworkId', name: 'WorkSubmit ', meta: { title: '作业提交页面' }, component: WorkSubmit },
        // { path: '/LookWork:homeworkId:classId', name: 'LookWork', meta: { title: '作业查看页面' }, component: LookWork },
        // { path: '/ReviewWork:homeworkId:stuId', name: 'ReviewWork', meta: { title: '作业批改页面' }, component: ReviewWork },
        // { path: '/GradeVue', name: 'GradeVue', meta: { title: '学生课程成绩页面' }, component: GradeVue },
    ]
    } 
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
  })
  
  
//   //router全局前置守卫
//   router.beforeEach((to, from, next) => {
//     // 判断该路由是否需要登录权限
//     if (to.path === "/login") {
//       next()
//     } else {
//       if (localStorage.getItem("user")) {
//         next();
//       } else {
//         next('/login')
//         Message.error("请先登录")
//       }
  
//     }
//   })
  
  
  
  export default router
